n,m = map(int,input().split())
dif = [[0]*(n+2)]
[dif.append([0]*(n+2)) for _ in range(n+1)]
while m>0:
    m -= 1
    x1,y1,x2,y2 = map(int,input().split())
    dif[x1][y1] += 1
    dif[x2+1][y1] -= 1
    dif[x1][y2+1] -= 1
    dif[x2+1][y2+1] += 1
arr = [[0]*(n+2)]
[arr.append([0]*(n+2)) for _ in range(n+1)]
for i in range(1,n+1):
    for j in range(1,n+1):
        arr[i][j] = dif[i][j] + arr[i-1][j] + arr[i][j-1] - arr[i-1][j-1]
        print(arr[i][j]%2,end='')
    print()
